<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 冲塔怪
  Date: 2022/5/7
  Time: 21:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/jsp/common/left.jsp"%>
<html>
<head>
    <title>Title</title>
    <style>
        * {
            box-sizing: border-box;
        }
        body {
            font-family: Arial, Helvetica, sans-serif;
        }
        .main{
            margin-left: 160px;
        }
        .header {
            background-color: #f1f1f1;
            padding: 10px;
            text-align: center;
            font-size: 30px;
        }
        .content {
            margin-left: 20%;
            background-color: #ffffff;
            padding: 10px;
        }
        table{
            border: 1px solid;
            border-collapse: collapse;
            table-layout: fixed;  /*fiexed 列宽由表格宽度和列宽度设定。 默认。列宽度由单元格内容设定。*/
            word-break: break-all;   /*允许在单词内换行*/
            overflow:auto;
            text-align: center;
        }
        table tr td{
            border: 1px solid;
        }
        .footer {
            background-color: #f1f1f1;
            padding: 10px;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="main">
    <div class="header"><h2>订单详情</h2></div>
    <div class="content">
        <table>
            <tr>
                <td width="200px">商品名</td>
                <td width="200px">数量</td>
                <td width="200px">单价</td>
                <td width="200px">总金额</td>

            </tr>
            <c:forEach items="${sessionScope.orderItemList}" var="entry">
                <tr>
                    <td>${entry.name}</td>
                    <td>${entry.count}</td>
                    <td>${entry.price}</td>
                    <td>${entry.totalPrice}</td>
                </tr>
            </c:forEach>
        </table>
    </div>
    <div class="footer">
        <c:if test="${!'root'.equals(sessionScope.user.name)}">
            <a href="${pageContext.request.contextPath}/order?action=showAllOrders">返回订单页面</a>
        </c:if>

        <c:if test="${!'root'.equals(sessionScope.user.name)}">
            <a href="${pageContext.request.contextPath}/order?action=showMyOrders&userId=${sessionScope.user.id}">返回订单页面</a>
        </c:if>
    </div>
</div>
</body>
</html>


